
//------------------------------------------------------------------------------

using Apps.Models;
using Apps.IDAL.CY;
using System;
using System.Linq;

namespace Apps.DAL.CY
{
	public partial class CY_MIX_MIXDETAILRepository:BaseRepository<CY_MIX_MIXDETAIL>,ICY_MIX_MIXDETAILRepository,IDisposable
	{
	    public CY_MIX_MIXDETAILRepository(DBContainer db):base(db)
        {
        
        }

        public IQueryable<CY_MIX_MIXDETAILModel> QueryList(string ProjectID)
        {
            IQueryable<CY_MIX_MIXDETAILModel> result = from a in Context.CY_MIX_MIXDETAIL
                                                       join sf in Context.PUB_CY_STOCKPILE on a.STOCKPILE_ID equals sf.STOCKPILE_ID into sf
                                                       from tsf in sf.DefaultIfEmpty()
                                                       where a.PROJECT_ID == ProjectID
                                                       select new CY_MIX_MIXDETAILModel()
                                                       {
                                                           AAR = a.AAR,
                                                           CRC = a.CRC,
                                                           MT = a.MT,
                                                           PARTITION_NAME = tsf.PUB_CY_PARTITION.PARTITION_NAME,
                                                           PROJECT_ID = a.PROJECT_ID,
                                                           QNETAR_KACL = a.QNETAR_KACL,
                                                           QNETAR_MJ = a.QNETAR_MJ,
                                                           STD = a.STD,
                                                           STOCKPILE_ID = a.STOCKPILE_ID,
                                                           STOCKPILE_NAME = tsf.STOCKPILE_NAME,
                                                           VAR = a.VAR,
                                                           VDAF = a.VDAF,
                                                           MIX_WEIGHT = a.MIX_WEIGHT,
                                                           STORAGE_WEIGHT=a.STORAGE_WEIGHT
                                                       };
            return result;
        }
    }
}
